<?php 

header("Content-type: image/png");
// 建画面
$src = imageCreateTrueColor(400,200); 

//选颜色
$color = imageColorAllocate($src,50,50,50); 
//填充
imageFill($src,0,0,$color);

//选颜色
$color = imageColorAllocate($src,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));


// for ($i=0; $i <9 ; $i++) { 
// 	$color = imageColorAllocate($src,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));

// 	imagefilledrectangle($src, mt_rand(50,100), mt_rand(0,50) , mt_rand(100,200) , mt_rand(100,200) , $color );
// }


// $color = imageColorAllocate($src,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));


// imagefilledellipse ( $src, 200 , 100, 50 , 100 , $color );
// 

// for ($i=0; $i <100 ; $i++) { 
// 	$color = imageColorAllocate($src,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));

// 	// imageline ( $src , mt_rand(0,400) , mt_rand(0,100), mt_rand(0,400) , mt_rand(100,200) , $color );
// 	// 
// 	// imagesetpixel($src, mt_rand(0,400), mt_rand(0,200), $color);
// }

$str = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890";

$width =50;
for ($i=0; $i <4 ; $i++) { 

	$color = imageColorAllocate($src,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));

	$word = $str[mt_rand(0,strlen($str)-1)];

	$hieght = (200+100)/2;

	imagettftext ( $src, 100,mt_rand(-30,30) , $width, $hieght  ,$color , './kingthings Hand.ttf' , $word);

	$width +=85;
}


for ($i=0; $i <9 ; $i++) { 
	$color = imageColorAllocate($src,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));

	imagerectangle ($src, mt_rand(50,100), mt_rand(0,50) , mt_rand(100,200) , mt_rand(100,200) , $color );
}



//输出
imagepng($src,'./'.uniqid().'.png');  


//销毁
imageDestroy($src);






?>